This application is related to U.S. application entitled Computer Generated Paint Stamp Seaming Compensation, having Silicon Graphics Inc. Ser. No. 09/024,127 by Reiter et al, filed concurrently herewith and incorporated by reference herein.
1. Field of the Invention
The present invention is directed to the compensation of the electronic paint that an artist can apply to a computer based model and, more particularly, to the compensation of a paint stamp for the warping that occurs when the stamp, applied to a texture triangle, is warped, along with the triangle, to fit a model surface triangle.
2. Description of the Related Art
Computer generated three dimensional (3D) objects are typically comprised of polygons, typically triangles, of sufficiently small size that the surface of the model appears smooth. Surface detail (color, surface topology, reflectance, etc.) is applied to these smooth computer generated three-dimensional images by applying 2D images, known as textures, to the 3D models in a process called texture mapping. Much of the realism of the models is affected by these textures, and great care is therefore taken to produce the desired effects when painting the textures.
Digital paint is typically applied in brush strokes, with each stroke using a particular paint brush specified by the user. Various attributes of the brush must be specified before the brush can be used to produce a stroke. These attributes include, for example, the color of paint; the radius, aspect ratio, and rotational angle of the brush; and a detailed map specifying the amount of paint to be applied at each point in the brush. The collection of these attributes is called a brush stamp. Once the attributes are set, a digital image of the stamp is created: this is called the stamp image, or a stamp source image. Stamps can then be placed on a target image, such as a texture, by a copying the stamp image to various locations on the target. Paint brush strokes are typically applied by placing a sequence of consecutive stamps along the trajectory of a path as indicated by the user with a stylus or mouse pointer. The spacing between the stamps on the path determines the appearance of the stroke. Stamp spacing is typically another attribute specified by the user.
Paint may be applied to 3D models by either painting directly onto the flat texture, or by painting on the model. Although both are useful, only the latter method provides direct visual feedback as to the final appearance of the painted model.
Two methods are conventionally provided for painting in 3D: projective paint and surface paint. In projective painting, the paint is applied to a flat surface which is shaded and masked by the model in such a way that the paint appears to be applied directly to the surface. A separate projection step is then necessary to move the paint from this paint plane onto the various textures of the object.
The second 3D painting method is known as painting on the surface. In this approach, paint is applied directly onto the texture assigned to each surface. In particular, brush stamps are applied to the texture in a manner which is consistent with the conventional triangulated surface tessellation of computer based models. Stamps are centered at the world space position designated by the mouse or stylus pointer. That is, given a world space point in the interior of a surface triangle, the corresponding texture space point is found in the interior of the texture triangle assigned to it. The point in texture space is then used as the center of the stamp that it is to be placed. This gives rise to the problem illustrated in FIG. 1. As there is no inherent correlation between the size and orientation of the texture space and world space triangles, neighboring triangles may receive stamps that are identical in texture-space but whose appearances in world-space is greatly distorted. The circular stamp 2 of the desired shape in FIG. 1A when applied to the texture space triangle 4 in FIG. 1B is undistorted but when the texture space triangle 4 is mapped to the corresponding world space triangle 6, the stamp is distorted as depicted in FIG. 1C. These figures primarily depict shape and size distortion that occurs when the texture and world space triangles are of different shapes.
What is needed is a system that compensates for the shape and size distortion occurring when the paint stamp is transferred from texture space to world space.
Texture triangles in texture space, as noted above, often have an orientation that is not correlated with the orientation of the world space triangles. This lack of correlation causes rotational distortion This would not be a problem if all paint brushes and their stamps were circular but it is often the case that an electronic paint brush can have a non-circular shape associated with it.
What is needed is a system that preserves rotational coherence between polygons.
Distortion compensation as described herein is computed for each individual stamp before it is applied. However, the compensation compensates for a stamp which lies completely inside a single triangle. Unfortunately, this is seldom the case as stamps will generally overlap several triangles whose individual distortions differ, thus giving the stroke a very jagged appearance.
What is needed is a method of compensating for the differences in distortion caused by different triangles.
It is an object of the present invention to apply paint to world space objects in a manner such that the individual stamps are not distorted.
It is another object of the present invention to compensate a paint stamp before it is applied to a texture surface so that when it is transferred from texture space to world space the stamp shape appears as the artist would expect.
It is also an object of the present invention to provide a consistent coordinate frame that prevents rotational distortion, so that when the stamp is transferred from texture space to world space, the orientation of the stamp remains consistent.
It is a further object of the present invention to compensate for the distortions that can be caused by the paint stamp covering more than one polygon.
It is a further object of the present invention to provide a consistent set of distortion compensations, so that the individual stamps comprising a brush stroke will vary smoothly along the trajectory of the stroke, and embody it with a smooth appearance irrespective of the polygons affected by it.
The above objects can be attained by a system that predistorts a paint stamp using the difference in shape between the texture polygon and the world space target polygon before it is applied to a texture space surface. To preserve rotational invariance, a consistent coordinate frame is chosen for each surface within which the mapping between texture space and world space polygons occurs. The distortion compensation for a particular stamp inside a particular texture space polygon becomes a weighted average of the distortions of the target polygon and those of its three nearest neighbors.
These together with other objects and advantages, which will be subsequently apparent, reside in the details of construction and operation as more fully hereinafter described and claimed, reference being had to the accompanying drawings forming a part hereof, wherein like numerals refer to like parts throughout.